package cn.openea.perpartner.meily.web.entity;

import cn.openea.perpartner.common.core.exception.ServiceException;
import cn.openea.perpartner.common.core.utils.StringUtils;
import cn.openea.perpartner.meily.web.entity.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.time.LocalDate;

/**
 * (Enterprise)表实体类
 *
 * @author Weird077
 * @since 2023-05-28 10:23:40
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName("meily_enterprise")
public class Enterprise extends BaseEntity {
    @TableId
    @ApiModelProperty(value = "用户id")
    private Long userId;
    @ApiModelProperty(value = "昵称")
    private String nickName;
    @ApiModelProperty(value = "企业编号")
    private String enterpriseNo;
    @ApiModelProperty(value = "企业名称")
    private String enterpriseName;
    @ApiModelProperty(value = "法人姓名")
    private String legalPerson;
    @ApiModelProperty(value = "手机号")
    private String phoneNumber;
    @ApiModelProperty(value = "注册类型")
    private String registrationType;
    @ApiModelProperty(value = "组织机构代码")
    private String organizationCode;
    @ApiModelProperty(value = "经营范围")
    private String businessScope;
    @ApiModelProperty(value = "所属行业")
    private String industry;
    @ApiModelProperty(value = "营业执照")
    private String businessLicense;
    @ApiModelProperty(value = "授权转移码")
    private String transferCode;
    @ApiModelProperty(value = "授权转移状态")
    private String transferStatus;
    @ApiModelProperty(value = "头像")
    private String avatar;
    @ApiModelProperty(value = "企业简介")
    private String introduction;
    @ApiModelProperty(value = "所属地区 省")
    private String province;
    @ApiModelProperty(value = "所属地区 市")
    private String city;
    @ApiModelProperty(value = "所属地区 区")
    private String area;
    @ApiModelProperty(value = "成立日期")
    private LocalDate establishmentDate;
    @ApiModelProperty(value = "注册地址")
    private String registeredAddress;
    @ApiModelProperty(value = "注册资本")
    private String registeredCapital;
    @ApiModelProperty(value = "邮箱")
    private String email;
    @ApiModelProperty(value = "置顶排序（大于1才表示为置顶）")
    private Integer enterpriseTop;

    public String checkParams() {
        if (StringUtils.isBlank(enterpriseNo)) {
            return "企业编号不能为空";
        }
        if (StringUtils.isBlank(enterpriseName)) {
            throw new ServiceException("企业名称不能位空");
        }
        if (StringUtils.isBlank(organizationCode)) {
            throw new ServiceException("企业统一信用代码不能为空");
        }
        return "";
    }

}

